import React from 'react'
import { Routes, Route } from 'react-router-dom'
import './App.css'
import { history, HistoryRouter } from './utils/history'
import { AuthRoute } from './components/AuthRoute'

import Layout from '@/pages/Layout'
import Login from '@/pages/Login'

import Home from './pages/Home'
import Publish from './pages/Publish'
import Article from './pages/Article'

/* test... */
export default function App() {
  return (
    <div className="App">
      <HistoryRouter history={history}>
        <Routes>
          <Route path='/' element={
            <AuthRoute>
              <Layout />
            </AuthRoute>
          }>
            <Route index element={<Home />} ></Route>
            <Route path='publish' element={<Publish />} ></Route>
            <Route path='article' element={<Article />} ></Route>
          </Route>
          <Route path='/login' element={<Login />}></Route>
        </Routes>
      </HistoryRouter>
    </div>
  )
}
